package com.techwells.heartfelt.controller.basic;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.techwells.heartfelt.constant.ErrorCodeConsField;
import com.techwells.heartfelt.controller.BaseController;
import com.techwells.heartfelt.service.basic.VersionService;
import com.techwells.heartfelt.utils.ErrorInfoUtil;
import com.techwells.heartfelt.utils.ResultInfoUtil;
import com.techwells.heartfelt.viewobject.basic.VersionViewObject;


@Controller("versionController")
@RequestMapping(value = "/basic/versionController")
public class VersionController extends BaseController<VersionController> {

	@Autowired
	public VersionService versionService;
	
	@RequestMapping(value = "/versionList/0", method = RequestMethod.POST)
	@ResponseBody
	public Object versionList(@RequestBody Map<String, String> params) {
		if(params == null || params.size() ==0){
			getLogger().debug("参数为空....");
			return ErrorInfoUtil.setErrorInfo(ErrorCodeConsField.ERROR_MSG_10003, this.getMessage(ErrorCodeConsField.ERROR_MSG_10003));
		}
		List<VersionViewObject> versions = new ArrayList<VersionViewObject>();
		versions=versionService.selectAll();
		System.out.println("OK...");
		return ResultInfoUtil.setSuccessInfo(versions);
	}
}
